package com.netease.pris.activity;

import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceManager;
import com.netease.a.a.e;
import com.netease.framework.PreferenceActivityEx;
import com.netease.framework.j;
import com.netease.framework.k;
import com.netease.pris.a.f;
import com.netease.pris.a.h;
import com.netease.pris.a.q;
import com.netease.pris.app.PrisApp;
import com.netease.update.CheckVersionService;
import java.io.File;

public class PRISActivitySetting extends PreferenceActivityEx
  implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener
{
  private static final String A = "system_setting_ad_closetime";
  private static final String B = "system_setting_source_list_first_show";
  private static final int O = 4;
  private static final int X = 1;
  private static final int Y = 2;
  private static final int Z = 1;
  private static final String a = PRISActivitySetting.class.getSimpleName();
  private static final int aa = 2;
  private static final String b = "https://market.android.com/details?id=com.netease.pris";
  private static final String c = "mode";
  private static final int d = 1;
  private static final int e = 2;
  private static final String f = "system_setting_predownload";
  private static final String g = "system_setting_columnkey";
  private static final String h = "system_setting_night_mode2";
  private static final String i = "system_setting_textsize";
  private static final String j = "system_setting_allow_or_not_mobile_network_offline_download";
  private static final String k = "system_setting_text_mode";
  private static final String l = "system_setting_night_mode";
  private static final String m = "system_setting_offline_download";
  private static final String n = "system_setting_auto_refresh";
  private static final String o = "system_setting_fullscreen";
  private static final String p = "system_setting_firstarticle";
  private static final String q = "system_setting_account";
  private static final String r = "system_setting_weiboaccount";
  private static final String s = "system_setting_clear_cache";
  private static final String t = "system_setting_clear_offline_download_cache";
  private static final String u = "system_setting_update";
  private static final String v = "system_setting_guide";
  private static final String w = "system_setting_report";
  private static final String x = "system_setting_about";
  private static final String y = "system_setting_comment";
  private static final String z = "system_setting_ad_close";
  private ListPreference C;
  private Preference D;
  private Preference E;
  private Preference F;
  private Preference G;
  private Preference H;
  private Preference I;
  private Preference J;
  private Preference K;
  private Preference L;
  private Preference M;
  private Context N;
  private l P = null;
  private l Q = null;
  private en R = null;
  private en S = null;
  private int T = 1;
  private ProgressDialog U;
  private boolean V = false;
  private Object W = new Object();

  public static int a(cn paramcn)
  {
    int i1 = 1;
    switch (e.a[paramcn.ordinal()])
    {
    case 2:
    default:
    case 1:
    case 3:
    case 4:
    }
    while (true)
    {
      return i1;
      i1 = 0;
      continue;
      i1 = 2;
      continue;
      i1 = 3;
    }
  }

  public static Intent a(Context paramContext)
  {
    Intent localIntent = new Intent(paramContext, PRISActivitySetting.class);
    localIntent.putExtra("mode", 2);
    return localIntent;
  }

  public static cn a(int paramInt)
  {
    cn localcn = cn.c;
    switch (paramInt)
    {
    default:
    case 0:
    case 1:
    case 2:
    case 3:
    }
    while (true)
    {
      return localcn;
      localcn = cn.a;
      continue;
      localcn = cn.b;
      continue;
      localcn = cn.c;
      continue;
      localcn = cn.d;
    }
  }

  public static void a(Context paramContext, long paramLong)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putLong("system_setting_ad_closetime", paramLong).commit();
  }

  public static void a(Context paramContext, cm paramcm)
  {
    SharedPreferences.Editor localEditor = PreferenceManager.getDefaultSharedPreferences(paramContext).edit();
    if (paramcm == cm.b);
    for (boolean bool = true; ; bool = false)
    {
      localEditor.putBoolean("system_setting_allow_or_not_mobile_network_offline_download", bool);
      return;
    }
  }

  public static void a(Context paramContext, cn paramcn)
  {
    int i1 = -1 + a(paramcn);
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putString("system_setting_textsize", Integer.toString(i1)).commit();
  }

  public static void a(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_predownload", paramBoolean).commit();
  }

  private void a(boolean paramBoolean)
  {
    String str;
    if (paramBoolean)
    {
      str = "internal.skin.black";
      k.a(this).a(PrisApp.a().B());
      com.netease.framework.d locald = new com.netease.framework.d(getApplicationContext());
      k.a(this).a(locald);
    }
    while (true)
    {
      if (str != null)
        PrisApp.a().a(str);
      k.a(this).e();
      j.a().g();
      return;
      str = getPackageName();
      k.a(this).a(null);
      k.a(this).a(null);
    }
  }

  public static void b(Context paramContext)
  {
    ek.a(paramContext);
    MainGridActivity.a(paramContext, 0, true, 0);
  }

  public static void b(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_columnkey", paramBoolean).commit();
  }

  public static void c(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_auto_refresh", paramBoolean).commit();
  }

  public static boolean c(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_predownload", false);
  }

  public static void d(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_fullscreen", paramBoolean).commit();
  }

  public static boolean d(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_columnkey", true);
  }

  public static void e(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_text_mode", paramBoolean).commit();
  }

  public static boolean e(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_auto_refresh", true);
  }

  public static cm f(Context paramContext)
  {
    if (PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_allow_or_not_mobile_network_offline_download", false));
    for (cm localcm = cm.b; ; localcm = cm.a)
      return localcm;
  }

  public static void f(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_night_mode", paramBoolean).commit();
  }

  public static cn g(Context paramContext)
  {
    return a(1 + Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(paramContext).getString("system_setting_textsize", "1")));
  }

  public static void g(Activity paramActivity)
  {
    Intent localIntent = new Intent(paramActivity, PRISActivitySetting.class);
    localIntent.putExtra("mode", 1);
    paramActivity.startActivity(localIntent);
  }

  public static void g(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_firstarticle", paramBoolean).commit();
  }

  private boolean g()
  {
    if (com.netease.b.a.d.h().i())
    {
      com.netease.pris.d.c.a(f(), 653);
      LoginActivity.a(this, 0, 5);
    }
    while (true)
    {
      return true;
      com.netease.pris.d.c.a(f(), 654);
      showDialog(4);
    }
  }

  private void h()
  {
    if (com.netease.b.a.d.h().i())
      this.D.setSummary(2131362067);
    while (true)
    {
      return;
      Preference localPreference = this.D;
      Object[] arrayOfObject = new Object[1];
      arrayOfObject[0] = com.netease.b.a.d.h().c();
      localPreference.setSummary(getString(2131362068, arrayOfObject));
    }
  }

  public static void h(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_source_list_first_show", paramBoolean).commit();
  }

  public static boolean h(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_fullscreen", false);
  }

  private Intent i()
  {
    return new Intent(this, PRISActivityReport.class);
  }

  public static void i(Context paramContext, boolean paramBoolean)
  {
    PreferenceManager.getDefaultSharedPreferences(paramContext).edit().putBoolean("system_setting_ad_close", paramBoolean).commit();
  }

  public static boolean i(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_text_mode", false);
  }

  private Intent j()
  {
    return new Intent(this, PRISActivityGuide.class);
  }

  public static boolean j(Context paramContext)
  {
    if (!k.a(paramContext).c());
    for (int i1 = 1; ; i1 = 0)
      return i1;
  }

  private Intent k()
  {
    return new Intent(this, PRISActivityWBSetting.class);
  }

  public static boolean k(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_firstarticle", true);
  }

  private void l()
  {
    if (this.R != null)
    {
      this.R.cancel(true);
      this.R = null;
    }
    if (this.P != null)
    {
      this.P.cancel(true);
      this.P = null;
    }
    this.P = new l(this, this, this.T, 1);
    this.P.execute(new Void[0]);
  }

  public static boolean l(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_source_list_first_show", true);
  }

  private void m()
  {
    if (this.S != null)
    {
      this.S.cancel(true);
      this.S = null;
    }
    if (this.Q != null)
    {
      this.Q.cancel(true);
      this.Q = null;
    }
    this.Q = new l(this, this, this.T, 2);
    this.Q.execute(new Void[0]);
  }

  public static boolean m(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getBoolean("system_setting_ad_close", false);
  }

  public static long n(Context paramContext)
  {
    return PreferenceManager.getDefaultSharedPreferences(paramContext).getLong("system_setting_ad_closetime", 0L);
  }

  private void n()
  {
    Intent localIntent = com.netease.pris.a.b.a(this);
    if (com.netease.pris.a.b.a(this, localIntent))
      startActivity(localIntent);
    while (true)
    {
      return;
      com.netease.pris.a.b.a(this, "https://market.android.com/details?id=com.netease.pris");
    }
  }

  void a()
  {
    h.a(this, 2131362061);
  }

  void b()
  {
    String str1 = f.a(this, f.e(new File(e.b())) + f.e(new File(e.c())));
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = str1;
    String str2 = getString(2131362062, arrayOfObject);
    this.F.setSummary(str2);
  }

  void c()
  {
    long l1 = System.currentTimeMillis();
    com.netease.b.a.d.h().k();
    h();
    b(this);
    com.netease.pris.d.c.b(System.currentTimeMillis() - l1);
    com.netease.pris.d.c.a(com.netease.pris.protocol.c.b);
  }

  void e()
  {
    setTitle(2131362043);
    findPreference("system_setting_offline_download").setOnPreferenceClickListener(this);
    this.D = findPreference("system_setting_account");
    this.D.setOnPreferenceClickListener(this);
    h();
    this.C = ((ListPreference)findPreference("system_setting_textsize"));
    int i1 = a(g(this));
    ListPreference localListPreference = this.C;
    Object[] arrayOfObject1 = new Object[1];
    arrayOfObject1[0] = getResources().getStringArray(2131165192)[i1];
    localListPreference.setSummary(getString(2131362063, arrayOfObject1));
    this.C.setOnPreferenceChangeListener(this);
    this.E = findPreference("system_setting_weiboaccount");
    this.E.setOnPreferenceClickListener(this);
    if (com.netease.pris.c.l.c(this) <= 0)
      this.E.setSummary(2131362064);
    while (true)
    {
      this.E.setOnPreferenceClickListener(this);
      this.F = findPreference("system_setting_clear_cache");
      Preference localPreference2 = this.F;
      Object[] arrayOfObject3 = new Object[1];
      arrayOfObject3[0] = getString(2131362070);
      localPreference2.setSummary(getString(2131362062, arrayOfObject3));
      this.F.setOnPreferenceClickListener(this);
      this.G = findPreference("system_setting_clear_offline_download_cache");
      Preference localPreference3 = this.G;
      Object[] arrayOfObject4 = new Object[1];
      arrayOfObject4[0] = getString(2131362070);
      localPreference3.setSummary(getString(2131362062, arrayOfObject4));
      this.G.setOnPreferenceClickListener(this);
      this.H = findPreference("system_setting_update");
      this.H.setOnPreferenceClickListener(this);
      Preference localPreference4 = this.H;
      Object[] arrayOfObject5 = new Object[1];
      arrayOfObject5[0] = q.a(this);
      localPreference4.setSummary(getString(2131362066, arrayOfObject5));
      this.I = findPreference("system_setting_report");
      this.I.setOnPreferenceClickListener(this);
      this.J = findPreference("system_setting_guide");
      this.J.setOnPreferenceClickListener(this);
      this.L = findPreference("system_setting_comment");
      this.L.setOnPreferenceClickListener(this);
      this.K = findPreference("system_setting_about");
      this.K.setOnPreferenceClickListener(this);
      findPreference("system_setting_columnkey").setOnPreferenceChangeListener(this);
      findPreference("system_setting_allow_or_not_mobile_network_offline_download").setOnPreferenceChangeListener(this);
      findPreference("system_setting_auto_refresh").setOnPreferenceChangeListener(this);
      findPreference("system_setting_night_mode2").setOnPreferenceChangeListener(this);
      return;
      Preference localPreference1 = this.E;
      Object[] arrayOfObject2 = new Object[1];
      arrayOfObject2[0] = Integer.valueOf(com.netease.pris.c.l.c(this));
      localPreference1.setSummary(getString(2131362065, arrayOfObject2));
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    addPreferencesFromResource(2131034115);
    this.N = this;
    e();
    if (getIntent() != null)
      this.T = getIntent().getIntExtra("mode", 1);
    String[] arrayOfString1 = new String[2];
    arrayOfString1[0] = e.b();
    arrayOfString1[1] = e.c();
    this.R = new en(this, this, 1, arrayOfString1);
    this.R.execute(new Void[0]);
    String[] arrayOfString2 = new String[2];
    arrayOfString2[0] = e.d();
    arrayOfString2[1] = e.e();
    this.S = new en(this, this, 2, arrayOfString2);
    this.S.execute(new Void[0]);
  }

  protected Dialog onCreateDialog(int paramInt)
  {
    switch (paramInt)
    {
    default:
    case 4:
    }
    AlertDialog.Builder localBuilder;
    Object[] arrayOfObject;
    for (Object localObject = super.onCreateDialog(paramInt); ; localObject = localBuilder.setMessage(getString(2131362051, arrayOfObject)).setPositiveButton(2131362052, new d(this)).setNegativeButton(2131362053, new b(this)).create())
    {
      return localObject;
      localBuilder = new AlertDialog.Builder(this).setIcon(2130837639).setTitle(2131362050);
      arrayOfObject = new Object[1];
      arrayOfObject[0] = com.netease.b.a.d.h().c();
    }
  }

  protected void onDestroy()
  {
    super.onDestroy();
    if (this.P != null)
    {
      this.P.cancel(true);
      this.P = null;
    }
    if (this.R != null)
    {
      this.R.cancel(true);
      this.R = null;
    }
    if (this.S != null)
    {
      this.S.cancel(true);
      this.S = null;
    }
    if (this.Q != null)
    {
      this.Q.cancel(true);
      this.Q = null;
    }
  }

  protected void onNewIntent(Intent paramIntent)
  {
    super.onNewIntent(paramIntent);
    if (paramIntent != null)
      this.T = paramIntent.getIntExtra("mode", 1);
  }

  public boolean onPreferenceChange(Preference paramPreference, Object paramObject)
  {
    int i1 = 1;
    String str1 = paramPreference.getKey();
    if (str1.equals("system_setting_textsize"))
    {
      int i2 = 1 + Integer.parseInt((String)paramObject);
      this.C.setValueIndex(i2);
      String str2 = getResources().getStringArray(2131165192)[i2];
      ListPreference localListPreference = this.C;
      Object[] arrayOfObject = new Object[i1];
      arrayOfObject[0] = str2;
      localListPreference.setSummary(getString(2131362063, arrayOfObject));
      com.netease.pris.d.c.a(f(), 642, str2);
    }
    while (true)
    {
      return i1;
      if (str1.equals("system_setting_columnkey"))
      {
        if (((Boolean)paramObject).booleanValue())
        {
          com.netease.pris.d.c.a(f(), 640);
          continue;
        }
        com.netease.pris.d.c.a(f(), 641);
        continue;
      }
      if (str1.equals("system_setting_allow_or_not_mobile_network_offline_download"))
      {
        if (((Boolean)paramObject).booleanValue())
        {
          com.netease.pris.d.c.a(f(), 643);
          continue;
        }
        com.netease.pris.d.c.a(f(), 644);
        continue;
      }
      if (str1.equals("system_setting_auto_refresh"))
      {
        if (((Boolean)paramObject).booleanValue())
        {
          com.netease.pris.d.c.a(f(), 658);
          continue;
        }
        com.netease.pris.d.c.a(f(), 659);
        continue;
      }
      if (str1.equals("system_setting_night_mode2"))
      {
        a(((Boolean)paramObject).booleanValue());
        continue;
      }
      i1 = 0;
    }
  }

  public boolean onPreferenceClick(Preference paramPreference)
  {
    boolean bool = true;
    String str = paramPreference.getKey();
    if (str.equals("system_setting_account"))
      bool = g();
    while (true)
    {
      return bool;
      if (str.equals("system_setting_about"))
      {
        com.netease.pris.d.c.a(f(), 665);
        PRISAboutActivity.a(this);
        continue;
      }
      if (str.equals("system_setting_update"))
      {
        com.netease.pris.d.c.a(f(), 660);
        CheckVersionService.a(this, bool);
        continue;
      }
      if (str.equals("system_setting_clear_cache"))
      {
        com.netease.pris.d.c.a(f(), 656);
        l();
        continue;
      }
      if (str.equals("system_setting_weiboaccount"))
      {
        com.netease.pris.d.c.a(f(), 655);
        startActivity(k());
        continue;
      }
      if (str.equals("system_setting_comment"))
      {
        com.netease.pris.d.c.a(f(), 664);
        n();
        continue;
      }
      if (str.equals("system_setting_clear_offline_download_cache"))
      {
        com.netease.pris.d.c.a(f(), 657);
        m();
        continue;
      }
      if (str.equals("system_setting_offline_download"))
      {
        com.netease.pris.d.c.a(f(), 645);
        startActivity(OfflineDownloadMgrActivity.b(this));
        continue;
      }
      if (str.equals("system_setting_guide"))
      {
        com.netease.pris.d.c.a(f(), 661);
        startActivity(j());
        continue;
      }
      if (str.equals("system_setting_report"))
      {
        com.netease.pris.d.c.a(f(), 662);
        startActivity(i());
      }
      bool = false;
    }
  }

  protected void onResume()
  {
    h();
    Preference localPreference = this.E;
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = Integer.valueOf(com.netease.pris.c.l.c(this));
    localPreference.setSummary(getString(2131362060, arrayOfObject));
    super.onResume();
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.PRISActivitySetting
 * JD-Core Version:    0.6.0
 */